import 'package:boss/models/second_discount.dart';
import 'package:flutter/cupertino.dart';
import 'package:json_annotation/json_annotation.dart';

import 'buy_give_discount.dart';
import 'food_discount.dart';

part 'sku.g.dart';

@JsonSerializable(explicitToJson: true)
class Sku {
  Sku() : key = GlobalKey();

  int skuId;
  int commodityId;
  int skuLeftCount;
  int skuPrice;
  int skuOriginalPrice;
  int skuMemberPrice;
  int skuMarketPrice;
  int skuCostPrice;
  int skuOnsale;
  String skuName;
  String updateTime;
  String skuImage;
  String commoditySkuCode;
  int commodityDiscountType;
  List<BuyGiveDiscount> buyGiveDiscountList;
  FoodDiscount foodDiscount;
  SecondDiscount secondDiscount;
  @JsonKey(ignore: true)
  GlobalKey key;

  factory Sku.fromJson(Map<String, dynamic> json) => _$SkuFromJson(json);

  Map<String, dynamic> toJson() => _$SkuToJson(this);
}
